#include <stdio.h>

int main(){
    int i;
    static long num_steps = 100000;
    double step=1.0/(double)num_steps;
    double x,pi,sum = 0.0;
    for (i = 0; i < num_steps; i++){
        x = (i+0.5)*step;
        sum = sum + 4.0 / (1.0 + x*x);
    }
    pi = step * sum;
    printf("pi=%lf\n",pi);
    return 0;
}